const mongoose = require('mongoose');

const userSchema = new mongoose.Schema({
  username: { type: String, unique: true },
  dietaryPreferences: { // 饮食偏好
    type: [String],
    enum: ['vegetarian', 'vegan', 'gluten-free', 'keto', 'halal']
  },
  allergies: [String],    // 过敏原
  cookingSkill: {         // 烹饪技能
    type: String,
    enum: ['beginner', 'intermediate', 'expert'],
    default: 'beginner'
  },
  favoriteRecipes: [{     // 收藏的食谱
    type: mongoose.Schema.Types.ObjectId,
    ref: 'Recipe'
  }],
  searchHistory: [String] // 搜索历史
}, { timestamps: true });

module.exports = mongoose.model('User', userSchema);